package com.kejiguan.ui.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.kejiguan.ui.R;
import com.kejiguan.ui.model.SubSelectSheduleObject;

import java.util.List;

/**
 * Created by YYY on 16/8/17.
 */
public class SelectSheduleObjectSubAdapter extends RecyclerView.Adapter<SelectSheduleObjectSubVH>{

    private Context context;
    private List<SubSelectSheduleObject> subSelectSheduleObjects;
    private LayoutInflater layoutInflater;

    public SelectSheduleObjectSubAdapter(Context context,List<SubSelectSheduleObject> subSelectSheduleObjects)
    {
        this.context=context;
        this.subSelectSheduleObjects=subSelectSheduleObjects;
        layoutInflater=LayoutInflater.from(context);
    }

    @Override
    public SelectSheduleObjectSubVH onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView=layoutInflater.inflate(R.layout.activity_select_timing_shedule_object_sub_item_layout,null);
        return new SelectSheduleObjectSubVH(itemView);
    }

    @Override
    public void onBindViewHolder(SelectSheduleObjectSubVH holder, int position) {

        SubSelectSheduleObject subSelectSheduleObject=subSelectSheduleObjects.get(position);

        holder.exhibitionName.setText("是否已选择:"+subSelectSheduleObject.isSelect());
    }

    @Override
    public int getItemCount() {
        if (null==subSelectSheduleObjects)
        {
            return 0;
        }else {
            return subSelectSheduleObjects.size();
        }
    }
}
